#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    // make sure php script being executed is within phproot folder
    char *p;
    p = strchr(argv[1], '/');
    if (p != NULL) {
        return 1;
    }

    // without this invoking a bash script from within a php script
    // results in exiting the root account
    setuid(0);

    // execute php script
    char command[128] = "php /usr/local/src/php/pepandlove-daemon/phproot/";
    strcat(command, argv[1]);
    system(command);
    return 0;
}
